/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/memory
// Copyright( c) 2013.  All Rights Reserved
//
// File:		AEChangeManagerI.h
// Author:		Gianluca Belardelli
// Date:		09/04/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AECHANGEMANAGERI_H_
#define _AECHANGEMANAGERI_H_

class AEChangeManagerI : public AEObserverI
{
public:

    /// <summary>
    ///  Associates the provided IObserver with the given ISubject aspects of interest.
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <param name="pInSubject">A pointer to the ISubject.</param>
    /// <param name="uInIntrestBits">The aspects of interest that changed as defined by the supplied 
    ///				ISubject's published interest bits..</param>
    /// <param name="pInObserver">A pointer to the IObserver.</param>
	/// <param name="observerIdBits">Bitmask of the interest bits. (default = System::Types::All)</param>
    /// <returns>One of the following Error codes:
    ///     Error::Success
    ///			No error.
    ///     Error::InvalidAddress 
    ///			pInObserver and/or pInSubject was NULL.
    ///     Error::OutOfMemory                                   
    ///			Not enough memory is available to resolve the change.
    ///</returns>
	virtual AEUINT32 Register( AESubjectI *lpInSubject, AEUINT32 uiInIntrestBits, AEObserverI *lpInObserver, AEUINT32 uiObserverIdMask = 0xFFFFFFFF ) = 0;
    
    /// <summary>
    ///   Disassociates the provided IObserver from the supplied ISubject.
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <param name="pInSubject">A pointer to the ISubject.</param>
    /// <param name="pInObserver">A pointer to the IObserver.</param>
    /// <returns>One of the following Error codes:
    ///     Error::Success
    ///			No error.
    ///     Error::InvalidAddress 
    ///			pInObserver and/or pInSubject was NULL.
    ///</returns>
    virtual AEUINT32 Unregister( AESubjectI *lpInSubject, AEObserverI *lpInObserver ) = 0; 

    /// <summary>
    ///  Distributes the queued changes..
    /// </summary>
    /// <remarks>
    ///	 Intended to be called after all ISubject's have changed state to 
    ///	 deliver relevant queued change notifications to registered 
    ///	 IObservers via. IObserver::Update().
    /// </remarks>
    /// <returns>One of the following Error codes:
    ///     Error::Success
    ///			No error.
    ///     Error::InvalidAddress 
    ///			pInObserver and/or pInSubject was NULL.
    ///     Error::OutOfMemory
    ///			Not enough memory is available to resolve the change.
    ///</returns>
    virtual AEUINT32 DistributeQueuedChanges( AEUINT32 uiSystemsToBeNotified = 0xFFFFFFFF,
												AEUINT32 uiChangesToDist = 0xFFFFFFFF ) = 0;
    
};

#endif // _AECHANGEMANAGERI_H_
